<?php
/**
 * 企业管理模块
 * User: lyc
 * Date: 2016/11/21
 * Time: 13:51
 */
class Involved_EnterpriseModel extends BaseModel
{

    protected $table = 'enterprise';

    /**
     *
     *企业列表
     */
    public function CompanyList(){
        return  DB::table($this->table)
            ->select('auto_id','name','corporation_name','phone','audit_status')
            ->get();
    }

    /**
     * @param $company_id
     * @return mixed
     * 根据企业ID查询信息
     */
    public function GetCompanyId($auto_id)
    {
        return DB::table($this->table)
            ->select()
            ->where('auto_id',$auto_id)
            ->first();
    }
    //企业详细
    public function GetEnterprise($auto_id)
    {
        $enterprise_info = DB::table($this->table)
            ->select('auto_id','name','registered_capital','registered_address','registered_time','company_size','company_status'
                ,'corporation_name','phone','whether_crime','company_account','bankcode','brief','audit_status','add_time','businessLicense','taxNo','unifiedCode','orgNo','creditCode','contact','contactPhone')
            ->where('auto_id',$auto_id)
            ->first();
        $enterprise_info->add_time = date('Y-m-d H:i:s',$enterprise_info->add_time);
        if($enterprise_info->audit_status == 0 ){
            $enterprise_info->audit_status  = "正在审核";
        }elseif($enterprise_info->audit_status == 1){
            $enterprise_info->audit_status  = "审核通过";
        }

        $enterprise_explain = [
            'auto_id'   => '企业ID',
            'name' => '企业名称',
            'registered_capital'      => '注册资本',
            'registered_address' => '注册地址',
            'registered_time'    => '注册时间',
            'company_size' => '公司规模',
            'company_status'  => '公司经营状况',
            'corporation_name'  => '法人名称',
            'phone'  => '联系方式',
            'whether_crime'  => '是否犯罪',
            'company_account'  => '公司对公账户',
            'bankcode'  => '银行代码',
            'brief'  => '公司简介',
            'audit_status'  => '审核状态',
            'add_time'  => '添加时间',
            'businessLicense'  => '开户银行许可证',
            'taxNo'  => '税务登记号',
            'unifiedCode'  => '统一社会信用代码',
            'orgNo'  => '组织机构代码',
            'creditCode'  => '机构信息代码',
            'contact'  => '企业联系人',
            'contactPhone'  => '联系人手机号',
        ];
        $data = [
            'topInfo'   => '企业ID:'.$auto_id,
            // 项目附加数据
            'enterprise_info'      => $enterprise_info,
            // 字段说明
            'fieldInfo' => $enterprise_explain,
        ];
        return $data;
    }




}